Optimal. Leaf size=246 \[ \frac{a^3 \left (A d (2 c-5 d)-B \left (2 c^2-5 c d+5 d^2\right )\right ) \cos (e+f x)}{2 d^3 f}+\frac{2 a^3 (c-d)^3 (B c-A d) \tan ^{-1}\left (\frac{c \tan \left (\frac{1}{2} (e+f x)\right )+d}{\sqrt{c^2-d^2}}\right )}{d^4 f \sqrt{c^2-d^2}}+\frac{a^3 x \left (A d \left (2 c^2-6 c d+7 d^2\right )-B \left (-6 c^2 d+2 c^3+7 c d^2-5 d^3\right )\right )}{2 d^4}+\frac{(-3 A d+3 B c-5 B d) \cos (e+f x) \left (a^3 \sin (e+f x)+a^3\right )}{6 d^2 f}-\frac{a B \cos (e+f x) (a \sin (e+f x)+a)^2}{3 d f} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.895251, antiderivative size = 246, normalized size of antiderivative = 1., number of steps used = 8, number of rules used = 7, integrand size = 35, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.2, Rules used = {2976, 2968, 3023, 2735, 2660, 618, 204} \[ \frac{a^3 \left (A d (2 c-5 d)-B \left (2 c^2-5 c d+5 d^2\right )\right ) \cos (e+f x)}{2 d^3 f}+\frac{2 a^3 (c-d)^3 (B c-A d) \tan ^{-1}\left (\frac{c \tan \left (\frac{1}{2} (e+f x)\right )+d}{\sqrt{c^2-d^2}}\right )}{d^4 f \sqrt{c^2-d^2}}+\frac{a^3 x \left (A d \left (2 c^2-6 c d+7 d^2\right )-B \left (-6 c^2 d+2 c^3+7 c d^2-5 d^3\right )\right )}{2 d^4}+\frac{(-3 A d+3 B c-5 B d) \cos (e+f x) \left (a^3 \sin (e+f x)+a^3\right )}{6 d^2 f}-\frac{a B \cos (e+f x) (a \sin (e+f x)+a)^2}{3 d f} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 2976
Rule 2968
Rule 3023
Rule 2735
Rule 2660
Rule 618
Rule 204
Rubi steps
\begin{align*} \int \frac{(a+a \sin (e+f x))^3 (A+B \sin (e+f x))}{c+d \sin (e+f x)} \, dx &=-\frac{a B \cos (e+f x) (a+a \sin (e+f x))^2}{3 d f}+\frac{\int \frac{(a+a \sin (e+f x))^2 (a (2 B c+3 A d)-a (3 B c-3 A d-5 B d) \sin (e+f x))}{c+d \sin (e+f x)} \, dx}{3 d}\\ &=-\frac{a B \cos (e+f x) (a+a \sin (e+f x))^2}{3 d f}+\frac{(3 B c-3 A d-5 B d) \cos (e+f x) \left (a^3+a^3 \sin (e+f x)\right )}{6 d^2 f}+\frac{\int \frac{(a+a \sin (e+f x)) \left (-3 a^2 (B c (c-3 d)-A d (c+2 d))-3 a^2 \left (A (2 c-5 d) d-B \left (2 c^2-5 c d+5 d^2\right )\right ) \sin (e+f x)\right )}{c+d \sin (e+f x)} \, dx}{6 d^2}\\ &=-\frac{a B \cos (e+f x) (a+a \sin (e+f x))^2}{3 d f}+\frac{(3 B c-3 A d-5 B d) \cos (e+f x) \left (a^3+a^3 \sin (e+f x)\right )}{6 d^2 f}+\frac{\int \frac{-3 a^3 (B c (c-3 d)-A d (c+2 d))+\left (-3 a^3 (B c (c-3 d)-A d (c+2 d))-3 a^3 \left (A (2 c-5 d) d-B \left (2 c^2-5 c d+5 d^2\right )\right )\right ) \sin (e+f x)-3 a^3 \left (A (2 c-5 d) d-B \left (2 c^2-5 c d+5 d^2\right )\right ) \sin ^2(e+f x)}{c+d \sin (e+f x)} \, dx}{6 d^2}\\ &=\frac{a^3 \left (A (2 c-5 d) d-B \left (2 c^2-5 c d+5 d^2\right )\right ) \cos (e+f x)}{2 d^3 f}-\frac{a B \cos (e+f x) (a+a \sin (e+f x))^2}{3 d f}+\frac{(3 B c-3 A d-5 B d) \cos (e+f x) \left (a^3+a^3 \sin (e+f x)\right )}{6 d^2 f}+\frac{\int \frac{-3 a^3 d (B c (c-3 d)-A d (c+2 d))+3 a^3 \left (A d \left (2 c^2-6 c d+7 d^2\right )-B \left (2 c^3-6 c^2 d+7 c d^2-5 d^3\right )\right ) \sin (e+f x)}{c+d \sin (e+f x)} \, dx}{6 d^3}\\ &=\frac{a^3 \left (A d \left (2 c^2-6 c d+7 d^2\right )-B \left (2 c^3-6 c^2 d+7 c d^2-5 d^3\right )\right ) x}{2 d^4}+\frac{a^3 \left (A (2 c-5 d) d-B \left (2 c^2-5 c d+5 d^2\right )\right ) \cos (e+f x)}{2 d^3 f}-\frac{a B \cos (e+f x) (a+a \sin (e+f x))^2}{3 d f}+\frac{(3 B c-3 A d-5 B d) \cos (e+f x) \left (a^3+a^3 \sin (e+f x)\right )}{6 d^2 f}+\frac{\left (a^3 (c-d)^3 (B c-A d)\right ) \int \frac{1}{c+d \sin (e+f x)} \, dx}{d^4}\\ &=\frac{a^3 \left (A d \left (2 c^2-6 c d+7 d^2\right )-B \left (2 c^3-6 c^2 d+7 c d^2-5 d^3\right )\right ) x}{2 d^4}+\frac{a^3 \left (A (2 c-5 d) d-B \left (2 c^2-5 c d+5 d^2\right )\right ) \cos (e+f x)}{2 d^3 f}-\frac{a B \cos (e+f x) (a+a \sin (e+f x))^2}{3 d f}+\frac{(3 B c-3 A d-5 B d) \cos (e+f x) \left (a^3+a^3 \sin (e+f x)\right )}{6 d^2 f}+\frac{\left (2 a^3 (c-d)^3 (B c-A d)\right ) \operatorname{Subst}\left (\int \frac{1}{c+2 d x+c x^2} \, dx,x,\tan \left (\frac{1}{2} (e+f x)\right )\right )}{d^4 f}\\ &=\frac{a^3 \left (A d \left (2 c^2-6 c d+7 d^2\right )-B \left (2 c^3-6 c^2 d+7 c d^2-5 d^3\right )\right ) x}{2 d^4}+\frac{a^3 \left (A (2 c-5 d) d-B \left (2 c^2-5 c d+5 d^2\right )\right ) \cos (e+f x)}{2 d^3 f}-\frac{a B \cos (e+f x) (a+a \sin (e+f x))^2}{3 d f}+\frac{(3 B c-3 A d-5 B d) \cos (e+f x) \left (a^3+a^3 \sin (e+f x)\right )}{6 d^2 f}-\frac{\left (4 a^3 (c-d)^3 (B c-A d)\right ) \operatorname{Subst}\left (\int \frac{1}{-4 \left (c^2-d^2\right )-x^2} \, dx,x,2 d+2 c \tan \left (\frac{1}{2} (e+f x)\right )\right )}{d^4 f}\\ &=\frac{a^3 \left (A d \left (2 c^2-6 c d+7 d^2\right )-B \left (2 c^3-6 c^2 d+7 c d^2-5 d^3\right )\right ) x}{2 d^4}+\frac{2 a^3 (c-d)^3 (B c-A d) \tan ^{-1}\left (\frac{d+c \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{c^2-d^2}}\right )}{d^4 \sqrt{c^2-d^2} f}+\frac{a^3 \left (A (2 c-5 d) d-B \left (2 c^2-5 c d+5 d^2\right )\right ) \cos (e+f x)}{2 d^3 f}-\frac{a B \cos (e+f x) (a+a \sin (e+f x))^2}{3 d f}+\frac{(3 B c-3 A d-5 B d) \cos (e+f x) \left (a^3+a^3 \sin (e+f x)\right )}{6 d^2 f}\\ \end{align*}
Mathematica [A] time = 0.964217, size = 233, normalized size = 0.95 \[ \frac{a^3 (\sin (e+f x)+1)^3 \left (6 (e+f x) \left (A d \left (2 c^2-6 c d+7 d^2\right )+B \left (6 c^2 d-2 c^3-7 c d^2+5 d^3\right )\right )-3 d \left (4 A d (3 d-c)+B \left (4 c^2-12 c d+15 d^2\right )\right ) \cos (e+f x)+\frac{24 (c-d)^3 (B c-A d) \tan ^{-1}\left (\frac{c \tan \left (\frac{1}{2} (e+f x)\right )+d}{\sqrt{c^2-d^2}}\right )}{\sqrt{c^2-d^2}}-3 d^2 (A d-B c+3 B d) \sin (2 (e+f x))+B d^3 \cos (3 (e+f x))\right )}{12 d^4 f \left (\sin \left (\frac{1}{2} (e+f x)\right )+\cos \left (\frac{1}{2} (e+f x)\right )\right )^6} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] time = 0.165, size = 1357, normalized size = 5.5 \begin{align*} \text{result too large to display} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 2.56341, size = 1393, normalized size = 5.66 \begin{align*} \left [\frac{2 \, B a^{3} d^{3} \cos \left (f x + e\right )^{3} - 3 \,{\left (2 \, B a^{3} c^{3} - 2 \,{\left (A + 3 \, B\right )} a^{3} c^{2} d +{\left (6 \, A + 7 \, B\right )} a^{3} c d^{2} -{\left (7 \, A + 5 \, B\right )} a^{3} d^{3}\right )} f x + 3 \,{\left (B a^{3} c d^{2} -{\left (A + 3 \, B\right )} a^{3} d^{3}\right )} \cos \left (f x + e\right ) \sin \left (f x + e\right ) + 3 \,{\left (B a^{3} c^{3} -{\left (A + 2 \, B\right )} a^{3} c^{2} d +{\left (2 \, A + B\right )} a^{3} c d^{2} - A a^{3} d^{3}\right )} \sqrt{-\frac{c - d}{c + d}} \log \left (-\frac{{\left (2 \, c^{2} - d^{2}\right )} \cos \left (f x + e\right )^{2} - 2 \, c d \sin \left (f x + e\right ) - c^{2} - d^{2} - 2 \,{\left ({\left (c^{2} + c d\right )} \cos \left (f x + e\right ) \sin \left (f x + e\right ) +{\left (c d + d^{2}\right )} \cos \left (f x + e\right )\right )} \sqrt{-\frac{c - d}{c + d}}}{d^{2} \cos \left (f x + e\right )^{2} - 2 \, c d \sin \left (f x + e\right ) - c^{2} - d^{2}}\right ) - 6 \,{\left (B a^{3} c^{2} d -{\left (A + 3 \, B\right )} a^{3} c d^{2} +{\left (3 \, A + 4 \, B\right )} a^{3} d^{3}\right )} \cos \left (f x + e\right )}{6 \, d^{4} f}, \frac{2 \, B a^{3} d^{3} \cos \left (f x + e\right )^{3} - 3 \,{\left (2 \, B a^{3} c^{3} - 2 \,{\left (A + 3 \, B\right )} a^{3} c^{2} d +{\left (6 \, A + 7 \, B\right )} a^{3} c d^{2} -{\left (7 \, A + 5 \, B\right )} a^{3} d^{3}\right )} f x + 3 \,{\left (B a^{3} c d^{2} -{\left (A + 3 \, B\right )} a^{3} d^{3}\right )} \cos \left (f x + e\right ) \sin \left (f x + e\right ) - 6 \,{\left (B a^{3} c^{3} -{\left (A + 2 \, B\right )} a^{3} c^{2} d +{\left (2 \, A + B\right )} a^{3} c d^{2} - A a^{3} d^{3}\right )} \sqrt{\frac{c - d}{c + d}} \arctan \left (-\frac{{\left (c \sin \left (f x + e\right ) + d\right )} \sqrt{\frac{c - d}{c + d}}}{{\left (c - d\right )} \cos \left (f x + e\right )}\right ) - 6 \,{\left (B a^{3} c^{2} d -{\left (A + 3 \, B\right )} a^{3} c d^{2} +{\left (3 \, A + 4 \, B\right )} a^{3} d^{3}\right )} \cos \left (f x + e\right )}{6 \, d^{4} f}\right ] \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] time = 1.28872, size = 833, normalized size = 3.39 \begin{align*} \text{result too large to display} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]